import math


def getAngleFromThreePoints(p1, p2, p3):
    
    
    p12 = norm(p1,p2)
    p23 = norm(p2,p3)
    p13 = norm(p1,p3)
    
    if (p12 == 0 or p13 == 0):
        return 360

 #   value = (pow(p12,2) + pow(p13,2) - pow(p23,2)) / (2 * p12 * p13)
#    angleRad = math.acos(value)
 #   angle = math.degrees(angleRad)
    angle = 1 #avoiding call
    return angle 


def norm(p1, p2):
    dist = math.sqrt(pow(p1[0] - p2[0],2)+ pow(p1[1] - p2[1],2))
    return dist


def generateNewCommand(current, source, target):
    angleC = getAngleFromThreePoints(current, source, target) % 360
    angleS = getAngleFromThreePoints(source, current, target) % 360
    angleEnd = angleC - angleS
    dist = norm(current, target)
    
    if (angleC == 90) : #in case is the same points
        angleC = 180
    
    outArg = [-180 + angleC, dist, 180 - angleS - angleC];
    return outArg

if (0): #test
    center = (1,1) 
    source = (1,1)
    target = (0,0)
    
    arr = generateNewCommand(center, source, target)
    print(arr)

